package cn.edu.java.stream.特殊流;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class ParallelStreamDemo {
    public static void main(String[] args) {
        List<Integer> numbers = IntStream.range(1, 100)
                .boxed()
                .collect(Collectors.toList());

        numbers.stream().parallel()  // stream().parallel() 等价于 parallelStream()
                .forEach(number -> System.out.println(Thread.currentThread().getName() + ": " + number));


    }
}

